pub fn convert_base(num_str: &str, base_to: u32) -> String {
    // 解析输入，获取数字和源进制
    let (num_part, base_from) = parse_input(num_str);
    
    // 先转换为10进制
    let decimal = i64::from_str_radix(num_part, base_from).unwrap();
    
    // 从10进制转换到目标进制
    let mut result = String::new();
    let mut n = decimal;
    
    if n == 0 {
        return "0".to_string();
    }
    
    while n > 0 {
        let digit = n % (base_to as i64);
        let ch = if digit < 10 {
            (b'0' + digit as u8) as char
        } else {
            (b'a' + (digit - 10) as u8) as char // 一定是超过10的进制，才可能发生的情况
        };
        result.insert(0, ch);
        n /= base_to as i64;
    }
    
    result
}

fn parse_input(input: &str) -> (&str, u32) {
    let parts: Vec<&str> = input.trim_matches(')').split('(').collect();
    if parts.len() != 2 {
        panic!("Invalid input format");
    }
    
    let base = parts[1].parse::<u32>().unwrap();
    (parts[0], base)
}
